Skip to content

feat(examples): add examples:check command for typechecking JSDoc snippets - #38

Merged
jxom merged 2 commits into
mainfrom
feat/examples-check
May 21, 2026
Merged

jxom merged 2 commits into
mainfrom
feat/examples-check

Conversation

@jxom

@jxom jxom commented May 21, 2026

Copy link
Copy Markdown
Member

Summary

Adds zile examples:check [--fix] which extracts every fenced ts / ts twoslash / typescript block from JSDoc comments under src/, runs tsc --noEmit against them, and (optionally) runs each snippet through oxfmt.

Twoslash directive support

  • Snippets containing // @noErrors or // @errors: <codes> (twoslash conventions) are skipped from typechecking — they're intentionally meant to error.
  • Lines annotated with // [!code --] are stripped from the snippet before checking, so old diff lines don't break the build.

zile build integration

Adds an opt-in --check-examples flag to zile build to run examples:check before building.

Testing

bun test — 7 tests pass (4 existing + 3 new for the directive support).

…nippets

Adds `zile examples:check [--fix]` which extracts every fenced `ts` /
`ts twoslash` / `typescript` block from JSDoc comments under `src/`,
runs `tsc --noEmit` against them, and (optionally) runs each snippet
through `oxfmt`.

Snippets containing `// @noErrors` or `// @errors: <codes>` (twoslash
conventions) are skipped from typechecking. Lines annotated with
`// [!code --]` are stripped from the snippet before checking so old
diff lines don't break the build.

Also adds an opt-in `--check-examples` flag to `zile build`.

Amp-Thread-ID: https://ampcode.com/threads/T-019e488f-68ce-7377-8ce7-b3848e22594b
@pkg-pr-new

pkg-pr-new Bot commented May 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/zile@38

commit: cc86dc1

@socket-security

socket-security Bot commented May 21, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedoxfmt@​0.51.0991009296100

View full report

@jxom
jxom merged commit 33560f0 into main May 21, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant